package com.situ.mall.admin.controller;


import com.situ.mall.admin.entity.User;
import com.situ.mall.common.entity.Member;
import com.situ.mall.common.service.IMemberService;
import com.situ.mall.common.vo.TableVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author 闫佳宁
 * @since 2023-09-21
 */
@Controller
@RequestMapping("/member")
public class MemberController {
    @Autowired
    private IMemberService memberService;

    @Value("${file.path}")
    private String filePath;

    @GetMapping("/page")
    public String page(){
        return ("member");
    }

    @GetMapping("/select")
    @ResponseBody
    public TableVO select(Integer page, Integer limit, String username, String name, Integer status){
        return  memberService.select(page,limit,username,name,status);
    }


    @PostMapping("/status")
    @ResponseBody
    public void update(Integer id,String status){
        Member m=new Member();
        m.setId(id);
        m.setStatus(status);
        memberService.updateById1(m);
    }

    @PostMapping("/reset")
    @ResponseBody
    public void reset(Integer id){
        memberService.update(id);
    }
}


